<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
        <meta charset="UTF-8">
    <link rel="stylesheet" href="${initParam.root}css/table.css" type="text/css">
    <div align="center"><h2>장바구니</h2></div>
<table border="1" class="registerMemberTable"  style="margin: 0 auto ; width: 500px" >
	<thead>
		<tr>
			<th class="no">no</th>
			<th class="title">제목</th>
			<th class="count">수량</th>
			<th class="price">상품가격</th>
			<th class="delete">etc</th>	
		</tr>
	</thead>
	<tbody>
		<c:forEach var="cart" items="${requestScope.list}" varStatus="i">
			<tr>
				<!-- no,title,writer,password,content,write_date,view_count -->
				<td>${i.count}</td>
				<td><a href="${initParam.root }common/showDealContents.do?dealNumber=${cart.dealNumber }">
						${cart.dealTitle }</a></td>
				<td>${cart.cartCount }</td>
				<td>${cart.dealPrice }</td>
				<td><a href="${initParam.root}customer/deleteCart.do?customerId=${cart.customerId}&dealNumber=${cart.dealNumber}"><img id="writeImg" src="${initParam.root }/img/delete_btn.jpg"></a></td>
			</tr>
			<c:set var="total" value="${total+cart.dealPrice }" />
		</c:forEach>
		<tr align="right">
			<c:choose>
			<c:when test="${requestScope.list!=null }">
			<td colspan="3">총 결제금액 :  ${total }</td>
			<td colspan="2">
			<a href="${initParam.root}customer/transaction_ShowInfo.do?customerId=${sessionScope.login.customerId}"><img id="transactionImg" src="${initParam.root }/img/transaction_btn.jpg" width="50px"></a>
			</td>
			</c:when>
			<c:otherwise>
			<td colspan="5">장바구니에 담긴 물품이 없습니다.</td>
			</c:otherwise>
			</c:choose>
		</tr>
	</tbody>
</table>
